import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F


class TestNet(nn.Module):
    def __init__(self):
        super(TestNet, self).__init__()
        self.op = nn.KLDivLoss(reduction='sum')

    def forward(self, input_x, labels):
        out = self.op(input_x, labels)
        return [out]


if __name__ == "__main__":
    net = TestNet()

    x = torch.FloatTensor(np.ones([10,64]).astype(np.float32))
    labels = torch.FloatTensor(np.ones([10,64]).astype(np.float32))

    result = net(x, labels)
    print(result[0])
    print(result[0].mean())
    print(result[0].shape)


